﻿using MediatR;
using S.Services.SheepMale.Domain.PurchaseSales;
using S.Services.SheepMale.Infrastructure;
using S.Services.SheepMale.Read.Api.Application.ReadCommand.ReadMarketCommand;

namespace S.Services.SheepMale.Read.Api.Application.ReadCommandHandler.ReadMarketCommandHandler
{
	public class MarketGetCommandHandler : IRequestHandler<MarketGetCommand, EntityMarket>
	{
		private readonly IRepository<EntityMarket> repository;
		public MarketGetCommandHandler(IRepository<EntityMarket> repository)
		{
			this.repository = repository;
		}

		public async Task<EntityMarket> Handle(MarketGetCommand request, CancellationToken cancellationToken)
		{
			return await repository.GetAsync(request.marketId);
		}
	}
}
